import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator, TransitionPresets } from '@react-navigation/stack';
import React from 'react';
import {
  SafeAreaView,
  StatusBar,
} from 'react-native';
import Home from './src/modules/home/TestHome';
import Mine from './src/modules/mine/TestMine';

// 2. 路由器  保存了所有页面
const Stack = createStackNavigator()


function App(): JSX.Element {

  return (
    <SafeAreaView style={{ width: '100%', height: '100%' }}>
      <StatusBar
        barStyle={'dark-content'}
        backgroundColor={'white'}
      />
      {/* 1. NavigationContainer 导航栈容器 */}
      <NavigationContainer>
        {/* 2. 配置路由  initialRouteName 默认打开页面 */}
        <Stack.Navigator
          initialRouteName='home'
          screenOptions={{
            cardStyle:{elevation:1} // elevation 属性设置为了避免切换页面比例错乱
          }}
        >
          <Stack.Screen
            component={Home}
            name='home'
            options={{
              headerShown:false, // 隐藏自带的标题栏
              ...TransitionPresets.SlideFromRightIOS , // 页面切换动画  仿IOS风格
            }}
          />
          <Stack.Screen
            component={Mine}
            name='mine'
            options={{
              headerShown:false, // 隐藏自带的标题栏
              ...TransitionPresets.SlideFromRightIOS , // 页面切换动画 
            }}
          />
        </Stack.Navigator>
      </NavigationContainer>
    </SafeAreaView>
  );
}



export default App;
